package com.example.film.service;

import com.example.film.entity.FillingCompany;
import com.example.film.mapper.FillingCompanyMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class FillingCompanyServiceImpl implements FillingCompanyService{
    @Autowired
    private FillingCompanyMapper fillingCompanyMapper;

    @Override
    public List<FillingCompany> findFillingCompany() {
        return fillingCompanyMapper.findFillingCompany();
    }

    @Override
    public List<FillingCompany> findFillingCompanyInfo(Integer pageNum, Integer pageSize) {
        int startIndex = (pageNum - 1) * pageSize;
        return fillingCompanyMapper.findFillingCompanyInfo(startIndex,pageSize);
    }

    @Override
    public List<FillingCompany> findFillingCompanyByType(String type, Integer pageNum, Integer pageSize) {
        int startIndex = (pageNum - 1) * pageSize;
        return fillingCompanyMapper.findFillingCompanyByType(type,startIndex,pageSize);
    }

    @Override
    public List<FillingCompany> findFillingCompanyByYear(Integer year, Integer pageNum, Integer pageSize) {
        int startIndex = (pageNum - 1) * pageSize;
        return fillingCompanyMapper.findFillingCompanyByYear(year, startIndex, pageSize);
    }

    @Override
    public List<FillingCompany> findFillingCompanyByCondition(Integer year, Integer month, Integer pageNum, Integer pageSize) {
        int startIndex = (pageNum - 1) * pageSize;
        return fillingCompanyMapper.findFillingCompanyByCondition(year, month, startIndex, pageSize);
    }
}
